package com.example.mapper;



import com.example.bean.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserMapper {

    @Select("SELECT userId,userName,userPhone,userIdentity,userPassword,card,maxBorrowNum,nowBorrowNum,borrowTime,userImg FROM user WHERE userId=#{userId}")
    public User selectUserById(int userId);
    @Select("SELECT userId,userName,userPhone,userIdentity,userPassword,card,maxBorrowNum,nowBorrowNum,borrowTime,userImg FROM user")
    public List<User> selectUserAll();
    @Insert("INSERT INTO user(userId,userName,userPhone,userIdentity,userPassword,card,maxBorrowNum,nowBorrowNum,borrowTime,userImg) VALUES(#{userId},#{userName},#{userPhone},#{userIdentity},#{userPassword},#{card},#{maxBorrowNum},#{nowBorrowNum},#{borrowTime},#{userImg})")
    public int insertUser(User user);
    @Delete("DELETE FROM user WHERE userId=#{userId}")
    public int deleteUser(int userId);
    @Update("UPDATE user SET userName=#{userName},userPhone=#{userPhone},userIdentity=#{userIdentity},userPassword=#{userPassword},card=#{card},maxBorrowNum=#{maxBorrowNum},nowBorrowNum=#{nowBorrowNum},borrowTime=#{borrowTime},userImg=#{userImg} WHERE userId=#{userId}")
    public int updateUser(User user);
}
